﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WPFDemoMVVM.Services;

namespace WPFDemoMVVM.ViewModel
{
    public partial class UserInputViewModel : ObservableObject
    {
        private readonly IUserInputService _userInputService;

        public UserInputViewModel(IUserInputService userInputService)
        {
            _userInputService = userInputService;
        }


        [ObservableProperty]
        private string userInput;

        [RelayCommand]
        private void Input()
        {

            var userInput = _userInputService.RequestInputBox("请输入内容：", "用户输入", UserInput);

            if (!string.IsNullOrEmpty(userInput))
            {
                UserInput = userInput;
            }
        }

    }
}
